﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@WebApp.SiteStructure.Instance.SiteName</title>
    <meta name="description" content="@WebApp.SiteStructure.Instance.SiteName" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <link href="~/Content/Word2Boot/apple-touch-icon-57x57.png" sizes="57x57" rel="apple-touch-icon">
    <link href="~/Content/Word2Boot/apple-touch-icon-114x114.png" sizes="114x114" rel="apple-touch-icon">
    <link rel="shortcut icon" href="~/Content/Word2Boot/favicon.ico">
    <link rel="stylesheet" href="//blueimp.github.io/Gallery/css/blueimp-gallery.min.css">
    <link rel="stylesheet" href="~/Content/bootstrap-image-gallery.min.css">

    @Styles.Render("~/bundles/css")
    @Scripts.Render("~/bundles/modernizr")



</head>
<body>
    @if (Session["hideNavHelp"] == null)
    {
        <div id="navhelp" align="center" style="width: 100%;  float: none;  margin-bottom:0; margin-right: 0; padding-bottom:0;" class="navbar-toggle">
            <center>
                <div style="max-width: 350px;" class="panel panel-success">
                    <div style="float: right;"><button class="btn btn-default pull-right glyphicon glyphicon glyphicon-remove" onclick="HideNavHelp();"></button></div>
                    <div align="left" class="panel-heading" style="background-color: #F7F7F7;">
                        <h3 class="panel-title">To navigate this site</h3>
                    </div>
                    <div align="left" class="panel-body">
                        Click the Menu Icon in the TOP LEFT of the page.
                    </div>
                </div>
            </center>
        </div>
    }
            <!-- The Bootstrap Image Gallery lightbox, should be a child element of the document body -->
            <div id="blueimp-gallery" class="blueimp-gallery  blueimp-gallery-controls" data-use-bootstrap-modal="false">
                <!-- The container for the modal slides -->
                <div class="slides"></div>
                <!-- Controls for the borderless lightbox -->
                <h3 class="title"></h3>
                <a class="prev">‹</a>
                <a class="next">›</a>
                <a class="close">×</a>
                <a class="play-pause"></a>
                <ol class="indicator"></ol>
                <!-- The modal dialog, which will be used to wrap the lightbox content -->
                <div class="modal fade">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" aria-hidden="true">&times;</button>
                                <h4 class="modal-title"></h4>
                            </div>
                            <div class="modal-body next"></div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default pull-left prev">
                                    <i class="glyphicon glyphicon-chevron-left"></i>
                                    Previous
                                </button>
                                <button type="button" class="btn btn-primary next">
                                    Next
                                    <i class="glyphicon glyphicon-chevron-right"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        <nav class="navbar navbar-default navbar-fixed-top">
        <div id="custom-bootstrap-menu" class="navbar navbar-default navbar-fixed-top">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" onclick="HideNavHelp()" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    @if (WebApp.SiteStructure.Instance.SiteName == null) 
                    {
                        <text>Missing @WebApp.SiteStructure.mRoot<text>\home-Site Name.docx</text></text>
                    }
                    else 
                    {
                        @Html.ActionLink(WebApp.SiteStructure.Instance.SiteName, "Index", "Home", null, new { @class = "navbar-brand" })                    
                    }
                </div>
                <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                        @if ("Home" == ViewBag.mi)
                        {
                            <li class="active">@Html.ActionLink("Home", "Index", "Home")</li>
                        }
                        else
                        {
                            <li>@Html.ActionLink("Home", "Index", "Home")</li>
                        }

                        @{
                            string wPrevDropDown = "";   
                        }
                        @foreach (WebApp.MenuItem mi in WebApp.SiteStructure.Instance.MenuItems)
                        {
                            string wDropDown = "";
                            string wDropDownItem = "";
                            if (mi.Name.Contains("-"))
                            {
                                wDropDown = mi.Name.Substring(0, mi.Name.IndexOf("-"));
                                wDropDownItem = mi.Name.Substring(mi.Name.IndexOf("-")+1);
                            }

                            if (!wDropDown.Equals(wPrevDropDown))
                            {
                                if (!string.IsNullOrEmpty(wPrevDropDown))
                                {                                    
                                    wPrevDropDown = "";
                                    <text>@Html.Raw("</ul></li>")</text>
                                }

                                if (!string.IsNullOrEmpty(wDropDown))
                                {
                                    wPrevDropDown = wDropDown;
                                    <text>@Html.Raw("<li class='dropdown'><a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='false'>" + wDropDown + "<span class='caret'></span></a><ul class='dropdown-menu'>")</text>
                                }
                            }
                            if (!string.IsNullOrEmpty(wDropDownItem))
                            {
                                if (mi.Name == ViewBag.mi)
                                {
                                    <li class="active">@Html.ActionLink(wDropDownItem, "Content", "Home", new { mi = mi.Name }, null)</li>
                                }
                                else
                                {
                                    <li>@Html.ActionLink(wDropDownItem, "Content", "Home", new { mi = mi.Name }, null)</li>
                                }
                            }
                            else
                            {
                                if (mi.Name == ViewBag.mi)
                                {
                                    <li class="active">@Html.ActionLink(mi.Name, "Content", "Home", new { mi = mi.Name }, null)</li>
                                }
                                else
                                {
                                    <li>@Html.ActionLink(mi.Name, "Content", "Home", new { mi = mi.Name }, null)</li>
                                }
                            }
                        }
@if (Session["EditMode"] != null)
                        {
    <li>@Html.ActionLink("Exit Edit Mode", "EditMode", "Home")</li>
                        }
</ul>
                </div>
            </div>
        </div>
            </nav>
        <div class="container body-content">
            @RenderBody()
        </div>


        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/bootstrap")
        <script src="//blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script>
        <script src="~/Scripts/bootstrap-image-gallery.min.js"></script>

        @RenderSection("scripts", required: false)

        <script>

            function HideNavHelp() {
                if ($('#navhelp').length > 0 && !hit) {
                    hit = true;
                    $('#navhelp').addClass("hidden");
                    $.post("/Home/HideNavHelp");
                }
            }

            $(document).ready(function () {
                hit = false;
                $('a').click(function (event) {
                    if (!$(this).attr('href').startsWith("http") && !$(this).attr('href').startsWith("/Content/") && !$(this).attr('href').startsWith("/Home/PrevGameSheet")) {
                        event.preventDefault();
                        window.location.href = $(this).attr('href');
                    }
                });
            });
        </script>


</body>
</html>
